﻿@model Nop.Web.Models.Blogs.BlogPostModel
@{
    Layout = "~/Views/Shared/_TaokeRoot.cshtml";

    //title
    Html.AddTitleParts(Model.Title);
}
<div class="blogpost">
    <div class="page-title">
        <h1>@Model.Title</h1>
    </div>
    <div class="clear">
    </div>
    <div class="postdate">
        @Model.CreatedOn.ToString("D")
    </div>
    <div class="postbody">
        @Html.Raw(Model.Body)
    </div>
    <div class="clear">
    </div>
    <div class="tags">
        @if (Model.Tags.Count > 0)
        {
            @Html.Raw("标签")
            <text>:&nbsp;</text>
            for (int i = 0; i < Model.Tags.Count; i++)
            {
                var tag = Model.Tags[i];
            <a href="@Url.RouteUrl("BlogByTag", new { tag = tag })">@tag</a>
                if (i != Model.Tags.Count - 1)
                {
            <text>,&nbsp;</text>
                }
            }
        }
    </div>
    <div class="fright">
    <a href="@Url.RouteUrl("blog")" class="btn-back ui-btn-left ui-btn ui-btn-up-a ui-btn-icon-left ui-btn-corner-all ui-shadow"><span class="ui-btn-text">返回</span></a>
    </div>
    @if (Model.AllowComments)
    {
        <div class="clear">
        </div>
        <div class="blogcomments">
            <br />
            <div class="newcomment">
                @using (Html.BeginForm())
                {
                    
                    <div>
                        说两句吧
                        @Html.TextAreaFor(model => model.AddNewComment.CommentText)
                        @Html.ValidationMessageFor(model => model.AddNewComment.CommentText)
                    </div>
                    string result = TempData["nop.blog.addcomment.result"] as string;
                    if (!String.IsNullOrEmpty(result))
                    {
                    <div class="result">
                        @result
                    </div>
                    }
                    <div class="message-error">
                        @Html.ValidationSummary(true)
                    </div>
                    <div class="buttons">
                        <input type="submit" id="add-comment" name="add-comment" value="提交" />
                    </div>
                }
            </div>
            <div class="clear">
            </div>

            <div class="commentlist">
                @if (Model.Comments.Count > 0)
                {
                    <ul data-role="listview" data-inset="true" data-filter="false">
                        @foreach (var comment in Model.Comments)
                        {
                            <li>
                                <div class="blogcomment">
                                    <div class="commentinfo">
                                        <div class="userinfo">
                                            @if (comment.AllowViewingProfiles)
                                            {
                                                <a href="@Url.RouteUrl("CustomerProfile", new { id = comment.CustomerId })" class="username">@(comment.CustomerName)</a>
                                            }
                                            else
                                            {
                                                <span class="username">@(comment.CustomerName)</span>
                                            }
                                        </div>
                                        <div class="commenttime">
                                            评论于: <span class="statvalue">@comment.CreatedOn.ToString("g")</span>
                                        </div>
                                    </div>
                                    <div class="commentcontent">
                                        <div class="commentbody">
                                            <span class="commenttext">
                                                @Html.Raw(Nop.Core.Html.HtmlHelper.FormatText(comment.CommentText, false, true, false, false, false, false))
                                            </span>
                                        </div>
                                    </div>
                                </div>
                            </li>
                        }
                    </ul>
                }
            </div>
        </div>
    }
</div>
